package com.yoso.log.interfaces.controller.file;

import cn.hutool.core.io.FileUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * @author shizejin
 * @date 2022/6/20
 * @description:
 */
@RestController
@RequestMapping("/file")
@Api(tags = "文件")
@Slf4j
public class FileController {

    @GetMapping("down")
    @ApiOperation("获取文件流")
    public FileInputStream downLoadFile() throws FileNotFoundException {
        File file2 = FileUtil.file("C:\\Users\\12425\\Desktop\\密码配置.txt");
        FileInputStream fileInputStream = new FileInputStream(file2);
        FileOutputStream fileOutputStream = new FileOutputStream("C:\\Users\\12425\\Desktop\\密码配置2.txt");

        return fileInputStream;
    }
}
